virtual machine (or 'guest').
VM booting is controlled by setting one of the two mutually exclusive
-groups: "PV", and "HVM". If HVM.boot is the empty string, then paravirtual
-domain building and booting will be used; otherwise the VM will be loaded
-as an HVM domain, and booted using an emulated BIOS.
+groups: "PV", and "HVM". If HVM.boot\_policy is the empty string, then
+paravirtual domain building and booting will be used; otherwise the VM will
+be loaded as an HVM domain, and booted using an emulated BIOS.
When paravirtual booting is in use, the PV/bootloader field indicates the
bootloader to use. It may be "pygrub", in which case the platform's
PV/bootloader and PV/kernel are empty, then the behaviour is as if
PV/bootloader was specified as "pygrub".
-When using HVM booting, HVM/boot specifies the order of the boot devices.}} \\
+When using HVM booting, HVM/boot\_policy and HVM/boot\_params specify the
+boot handling. Only one policy is currently defined: "BIOS order". In
+this case, HVM/boot\_params should contain one key-value pair "order" = "N"
+where N is the string that will be passed to QEMU.}} \\
\hline
Quals & Field & Type & Description \\
\hline
$\mathit{RW}$ & {\tt PV/ramdisk} & string & path to the initrd \\
$\mathit{RW}$ & {\tt PV/args} & string & kernel command-line arguments \\
$\mathit{RW}$ & {\tt PV/bootloader\_args} & string & miscellaneous arguments for the bootloader \\
-$\mathit{RW}$ & {\tt HVM/boot} & string & device boot order \\
+$\mathit{RW}$ & {\tt HVM/boot\_policy} & string & HVM boot policy \\
+$\mathit{RW}$ & {\tt HVM/boot\_params} & (string $\rightarrow$ string) Map & HVM boot params \\
$\mathit{RW}$ & {\tt platform/std\_VGA} & bool & emulate standard VGA instead of cirrus logic \\
$\mathit{RW}$ & {\tt platform/serial} & string & redirect serial port to pty \\
$\mathit{RW}$ & {\tt platform/localtime} & bool & set RTC to local time \\
\vspace{0.3cm}
\vspace{0.3cm}
\vspace{0.3cm}
-\subsubsection{RPC name:~get\_HVM\_boot}
+\subsubsection{RPC name:~get\_HVM\_boot\_policy}
{\bf Overview:}
-Get the HVM/boot field of the given VM.
+Get the HVM/boot\_policy field of the given VM.
\noindent {\bf Signature:}
-\begin{verbatim} string get_HVM_boot (session_id s, VM ref self)\end{verbatim}
+\begin{verbatim} string get_HVM_boot_policy (session_id s, VM ref self)\end{verbatim}
\noindent{\bf Arguments:}
\vspace{0.3cm}
\vspace{0.3cm}
\vspace{0.3cm}
-\subsubsection{RPC name:~set\_HVM\_boot}
+\subsubsection{RPC name:~set\_HVM\_boot\_policy}
{\bf Overview:}
-Set the HVM/boot field of the given VM.
+Set the HVM/boot\_policy field of the given VM.
\noindent {\bf Signature:}
-\begin{verbatim} void set_HVM_boot (session_id s, VM ref self, string value)\end{verbatim}
+\begin{verbatim} void set_HVM_boot_policy (session_id s, VM ref self, string value)\end{verbatim}
\noindent{\bf Arguments:}
+\vspace{0.3cm}
+\vspace{0.3cm}
+\vspace{0.3cm}
+\subsubsection{RPC name:~get\_HVM\_boot\_params}
+
+{\bf Overview:}
+Get the HVM/boot\_params field of the given VM.
+
+ \noindent {\bf Signature:}
+\begin{verbatim} ((string -> string) Map) get_HVM_boot_params (session_id s, VM ref self)\end{verbatim}
+
+
+\noindent{\bf Arguments:}
+
+
+\vspace{0.3cm}
+\begin{tabular}{|c|c|p{7cm}|}
+ \hline
+{\bf type} & {\bf name} & {\bf description} \\ \hline
+{\tt VM ref } & self & reference to the object \\ \hline
+
+\end{tabular}
+
+\vspace{0.3cm}
+
+ \noindent {\bf Return Type:}
+{\tt
+(string $\rightarrow$ string) Map
+}
+
+
+value of the field
+\vspace{0.3cm}
+\vspace{0.3cm}
+\vspace{0.3cm}
+\subsubsection{RPC name:~set\_HVM\_boot\_params}
+
+{\bf Overview:}
+Set the HVM/boot\_params field of the given VM.
+
+ \noindent {\bf Signature:}
+\begin{verbatim} void set_HVM_boot_params (session_id s, VM ref self, (string -> string) Map value)\end{verbatim}
+
+
+\noindent{\bf Arguments:}
+
+
+\vspace{0.3cm}
+\begin{tabular}{|c|c|p{7cm}|}
+ \hline
+{\bf type} & {\bf name} & {\bf description} \\ \hline
+{\tt VM ref } & self & reference to the object \\ \hline
+
+{\tt (string $\rightarrow$ string) Map } & value & New value to set \\ \hline
+
+\end{tabular}
+
+\vspace{0.3cm}
+
+ \noindent {\bf Return Type:}
+{\tt
+void
+}
+
+
+
+\vspace{0.3cm}
+\vspace{0.3cm}
+\vspace{0.3cm}
+\subsubsection{RPC name:~add\_to\_HVM\_boot\_params}
+
+{\bf Overview:}
+Add the given key-value pair to the HVM/boot\_params field of the given VM.
+
+ \noindent {\bf Signature:}
+\begin{verbatim} void add_to_HVM_boot_params (session_id s, VM ref self, string key, string value)\end{verbatim}
+
+
+\noindent{\bf Arguments:}
+
+
+\vspace{0.3cm}
+\begin{tabular}{|c|c|p{7cm}|}
+ \hline
+{\bf type} & {\bf name} & {\bf description} \\ \hline
+{\tt VM ref } & self & reference to the object \\ \hline
+
+{\tt string } & key & Key to add \\ \hline
+
+{\tt string } & value & Value to add \\ \hline
+
+\end{tabular}
+
+\vspace{0.3cm}
+
+ \noindent {\bf Return Type:}
+{\tt
+void
+}
+
+
+
+\vspace{0.3cm}
+\vspace{0.3cm}
+\vspace{0.3cm}
+\subsubsection{RPC name:~remove\_from\_HVM\_boot\_params}
+
+{\bf Overview:}
+Remove the given key and its corresponding value from the HVM/boot\_params
+field of the given VM. If the key is not in that Map, then do nothing.
+
+ \noindent {\bf Signature:}
+\begin{verbatim} void remove_from_HVM_boot_params (session_id s, VM ref self, string key)\end{verbatim}
+
+
+\noindent{\bf Arguments:}
+
+
+\vspace{0.3cm}
+\begin{tabular}{|c|c|p{7cm}|}
+ \hline
+{\bf type} & {\bf name} & {\bf description} \\ \hline
+{\tt VM ref } & self & reference to the object \\ \hline
+
+{\tt string } & key & Key to remove \\ \hline
+
+\end{tabular}
+
+\vspace{0.3cm}
+
+ \noindent {\bf Return Type:}
+{\tt
+void
+}
+
+
+
\vspace{0.3cm}
\vspace{0.3cm}
\vspace{0.3cm}
\begin{verbatim}TASK_HANDLE_INVALID(handle)\end{verbatim}
\begin{center}\rule{10em}{0.1pt}\end{center}
+\subsubsection{VALUE\_NOT\_SUPPORTED}
+
+You attempted to set a value that is not supported by this implementation.
+The fully-qualified field name and the value that you tried to set are
+returned. Also returned is a developer-only diagnostic reason.
+
+\vspace{0.3cm}
+{\bf Signature:}
+\begin{verbatim}VALUE_NOT_SUPPORTED(field, value, reason)\end{verbatim}
+\begin{center}\rule{10em}{0.1pt}\end{center}
+
\subsubsection{VBD\_HANDLE\_INVALID}
You gave an invalid VBD handle. The VBD may have recently been deleted.
* A virtual machine (or 'guest').
*
* VM booting is controlled by setting one of the two mutually exclusive
- * groups: "PV", and "HVM". If HVM.boot is the empty string, then paravirtual
- * domain building and booting will be used; otherwise the VM will be loaded
- * as an HVM domain, and booted using an emulated BIOS.
+ * groups: "PV", and "HVM". If HVM.boot_policy is the empty string, then
+ * paravirtual domain building and booting will be used; otherwise the VM will
+ * be loaded as an HVM domain, and booted using an emulated BIOS.
*
* When paravirtual booting is in use, the PV/bootloader field indicates the
* bootloader to use. It may be "pygrub", in which case the platform's
* PV/bootloader and PV/kernel are empty, then the behaviour is as if
* PV/bootloader was specified as "pygrub".
*
- * When using HVM booting, HVM/boot specifies the order of the boot devices.
+ * When using HVM booting, HVM/boot_policy and HVM/boot_params specify the
+ * boot handling. Only one policy is currently defined: "BIOS order". In
+ * this case, HVM/boot_params should contain one key-value pair "order" = "N"
+ * where N is the string that will be passed to QEMU..
*/
char *pv_ramdisk;
char *pv_args;
char *pv_bootloader_args;
- char *hvm_boot;
+ char *hvm_boot_policy;
+ xen_string_string_map *hvm_boot_params;
bool platform_std_vga;
char *platform_serial;
bool platform_localtime;
/**
- * Get the HVM/boot field of the given VM.
+ * Get the HVM/boot_policy field of the given VM.
*/
extern bool
-xen_vm_get_hvm_boot(xen_session *session, char **result, xen_vm vm);
+xen_vm_get_hvm_boot_policy(xen_session *session, char **result, xen_vm vm);
+
+
+/**
+ * Get the HVM/boot_params field of the given VM.
+ */
+extern bool
+xen_vm_get_hvm_boot_params(xen_session *session, xen_string_string_map **result, xen_vm vm);
/**
/**
- * Set the HVM/boot field of the given VM.
+ * Set the HVM/boot_policy field of the given VM.
+ */
+extern bool
+xen_vm_set_hvm_boot_policy(xen_session *session, xen_vm vm, char *boot_policy);
+
+
+/**
+ * Set the HVM/boot_params field of the given VM.
+ */
+extern bool
+xen_vm_set_hvm_boot_params(xen_session *session, xen_vm vm, xen_string_string_map *boot_params);
+
+
+/**
+ * Add the given key-value pair to the HVM/boot_params field of the
+ * given VM.
+ */
+extern bool
+xen_vm_add_to_hvm_boot_params(xen_session *session, xen_vm vm, char *key, char *value);
+
+
+/**
+ * Remove the given key and its corresponding value from the
+ * HVM/boot_params field of the given VM. If the key is not in that Map, then
+ * do nothing.
*/
extern bool
-xen_vm_set_hvm_boot(xen_session *session, xen_vm vm, char *boot);
+xen_vm_remove_from_hvm_boot_params(xen_session *session, xen_vm vm, char *key);
/**
{ .key = "PV_bootloader_args",
.type = &abstract_type_string,
.offset = offsetof(xen_vm_record, pv_bootloader_args) },
- { .key = "HVM_boot",
+ { .key = "HVM_boot_policy",
.type = &abstract_type_string,
- .offset = offsetof(xen_vm_record, hvm_boot) },
+ .offset = offsetof(xen_vm_record, hvm_boot_policy) },
+ { .key = "HVM_boot_params",
+ .type = &abstract_type_string_string_map,
+ .offset = offsetof(xen_vm_record, hvm_boot_params) },
{ .key = "platform_std_VGA",
.type = &abstract_type_bool,
.offset = offsetof(xen_vm_record, platform_std_vga) },
free(record->pv_ramdisk);
free(record->pv_args);
free(record->pv_bootloader_args);
- free(record->hvm_boot);
+ free(record->hvm_boot_policy);
+ xen_string_string_map_free(record->hvm_boot_params);
free(record->platform_serial);
free(record->pci_bus);
xen_string_string_map_free(record->tools_version);
bool
-xen_vm_get_hvm_boot(xen_session *session, char **result, xen_vm vm)
+xen_vm_get_hvm_boot_policy(xen_session *session, char **result, xen_vm vm)
{
abstract_value param_values[] =
{
abstract_type result_type = abstract_type_string;
*result = NULL;
- XEN_CALL_("VM.get_HVM_boot");
+ XEN_CALL_("VM.get_HVM_boot_policy");
+ return session->ok;
+}
+
+
+bool
+xen_vm_get_hvm_boot_params(xen_session *session, xen_string_string_map **result, xen_vm vm)
+{
+ abstract_value param_values[] =
+ {
+ { .type = &abstract_type_string,
+ .u.string_val = vm }
+ };
+
+ abstract_type result_type = abstract_type_string_string_map;
+
+ *result = NULL;
+ XEN_CALL_("VM.get_HVM_boot_params");
return session->ok;
}
bool
-xen_vm_set_hvm_boot(xen_session *session, xen_vm vm, char *boot)
+xen_vm_set_hvm_boot_policy(xen_session *session, xen_vm vm, char *boot_policy)
{
abstract_value param_values[] =
{
{ .type = &abstract_type_string,
.u.string_val = vm },
{ .type = &abstract_type_string,
- .u.string_val = boot }
+ .u.string_val = boot_policy }
+ };
+
+ xen_call_(session, "VM.set_HVM_boot_policy", param_values, 2, NULL, NULL);
+ return session->ok;
+}
+
+
+bool
+xen_vm_set_hvm_boot_params(xen_session *session, xen_vm vm, xen_string_string_map *boot_params)
+{
+ abstract_value param_values[] =
+ {
+ { .type = &abstract_type_string,
+ .u.string_val = vm },
+ { .type = &abstract_type_string_string_map,
+ .u.set_val = (arbitrary_set *)boot_params }
+ };
+
+ xen_call_(session, "VM.set_HVM_boot_params", param_values, 2, NULL, NULL);
+ return session->ok;
+}
+
+
+bool
+xen_vm_add_to_hvm_boot_params(xen_session *session, xen_vm vm, char *key, char *value)
+{
+ abstract_value param_values[] =
+ {
+ { .type = &abstract_type_string,
+ .u.string_val = vm },
+ { .type = &abstract_type_string,
+ .u.string_val = key },
+ { .type = &abstract_type_string,
+ .u.string_val = value }
+ };
+
+ xen_call_(session, "VM.add_to_HVM_boot_params", param_values, 3, NULL, NULL);
+ return session->ok;
+}
+
+
+bool
+xen_vm_remove_from_hvm_boot_params(xen_session *session, xen_vm vm, char *key)
+{
+ abstract_value param_values[] =
+ {
+ { .type = &abstract_type_string,
+ .u.string_val = vm },
+ { .type = &abstract_type_string,
+ .u.string_val = key }
};
- xen_call_(session, "VM.set_HVM_boot", param_values, 2, NULL, NULL);
+ xen_call_(session, "VM.remove_from_HVM_boot_params", param_values, 2, NULL, NULL);
return session->ok;
}
static xen_vm create_new_vm(xen_session *session)
{
xen_string_string_map *vcpus_params = xen_string_string_map_alloc(1);
+ vcpus_params->contents[0].key = strdup("weight");
+ vcpus_params->contents[0].val = strdup("300");
xen_vm_record vm_record =
{
.name_label = "NewVM",
.actions_after_shutdown = XEN_ON_NORMAL_EXIT_DESTROY,
.actions_after_reboot = XEN_ON_NORMAL_EXIT_RESTART,
.actions_after_crash = XEN_ON_CRASH_BEHAVIOUR_PRESERVE,
- .hvm_boot = "",
- //.pv_bootloader = "pygrub",
- .pv_kernel = "/boot/vmlinuz-2.6.18-xenU",
+ .hvm_boot_policy = NULL,
+ .hvm_boot_params = NULL,
+ .pv_bootloader = "pygrub",
+ .pv_kernel = "/boot/vmlinuz-2.6.16.33-xen",
.pv_ramdisk = "",
.pv_args = "root=/dev/sda1 ro",
.pv_bootloader_args = ""
xen_vm vm;
xen_vm_create(session, &vm, &vm_record);
+ xen_string_string_map_free(vcpus_params);
+
if (!session->ok)
{
fprintf(stderr, "VM creation failed.\n");
'PV_ramdisk',
'PV_args',
'PV_bootloader_args',
- 'HVM_boot',
+ 'HVM_boot_policy',
+ 'HVM_boot_params',
'platform_std_VGA',
'platform_serial',
'platform_localtime',
'PV_ramdisk',
'PV_args',
'PV_bootloader_args',
- 'HVM_boot',
+ 'HVM_boot_policy',
+ 'HVM_boot_params',
'platform_std_VGA',
'platform_serial',
'platform_localtime',
def VM_get_PV_bootloader_args(self, session, vm_ref):
return self.VM_get('PV_bootloader_args', session, vm_ref)
- def VM_get_HVM_boot(self, session, vm_ref):
- return self.VM_get('HVM_boot', session, vm_ref)
+ def VM_get_HVM_boot_policy(self, session, vm_ref):
+ return self.VM_get('HVM_boot_policy', session, vm_ref)
+
+ def VM_get_HVM_boot_params(self, session, vm_ref):
+ return self.VM_get('HVM_boot_params', session, vm_ref)
def VM_get_platform_std_VGA(self, session, vm_ref):
dom = XendDomain.instance().get_vm_by_uuid(vm_ref)
return xen_api_error(['VM_ON_CRASH_BEHAVIOUR_INVALID', vm_ref])
return self.VM_set('actions_after_crash', session, vm_ref, action)
- def VM_set_HVM_boot(self, session, vm_ref, value):
- return self.VM_set('HVM_boot', session, vm_ref, value)
+ def VM_set_HVM_boot_policy(self, session, vm_ref, value):
+ if value != "" and value != "BIOS order":
+ return xen_api_error(
+ ['VALUE_NOT_SUPPORTED', 'VM.HVM_boot_policy', value,
+ 'Xend supports only the "BIOS order" boot policy.'])
+ else:
+ return self.VM_set('HVM_boot_policy', session, vm_ref, value)
+
+ def VM_set_HVM_boot_params(self, session, vm_ref, value):
+ return self.VM_set('HVM_boot_params', session, vm_ref, value)
+
+ def VM_add_to_HVM_boot_params(self, session, vm_ref, key, value):
+ dom = XendDomain.instance().get_vm_by_uuid(vm_ref)
+ if 'HVM_boot_params' not in dom.info:
+ dom.info['HVM_boot_params'] = {}
+ dom.info['HVM_boot_params'][key] = value
+ return xen_api_success_void()
+
+ def VM_remove_from_HVM_boot_params(self, session, vm_ref, key):
+ dom = XendDomain.instance().get_vm_by_uuid(vm_ref)
+ if 'HVM_boot_params' in dom.info \
+ and key in dom.info['HVM_boot_params']:
+ del dom.info['HVM_boot_params'][key]
+ return xen_api_success_void()
def VM_set_PV_bootloader(self, session, vm_ref, value):
return self.VM_set('PV_bootloader', session, vm_ref, value)
'PV_ramdisk': xeninfo.info.get('PV_ramdisk'),
'PV_args': xeninfo.info.get('PV_args'),
'PV_bootloader_args': xeninfo.info.get('PV_bootloader_args'),
- 'HVM_boot': xeninfo.info.get('HVM_boot'),
+ 'HVM_boot_policy': xeninfo.info.get('HVM_boot_policy'),
+ 'HVM_boot_params': xeninfo.info.get('HVM_boot_params'),
'platform_std_VGA': xeninfo.get_platform_std_vga(),
'platform_serial': xeninfo.get_platform_serial(),
'platform_localtime': xeninfo.get_platform_localtime(),
xendom = XendDomain.instance()
return xen_api_success(xendom.get_dev_property_by_uuid('vif', vif_ref,
'io_write_kbs'))
-
+
def VIF_get_all(self, session):
xendom = XendDomain.instance()
vifs = [d.get_vifs() for d in XendDomain.instance().list('all')]
from xen.xend.XendConstants import DOM_STATE_HALTED
log = logging.getLogger("xend.XendConfig")
-log.setLevel(logging.WARN)
+log.setLevel(logging.DEBUG)
"""
'PV_ramdisk': str,
'PV_args': str,
'PV_bootloader_args': str,
- 'HVM_boot': str,
+ 'HVM_boot_policy': str,
+ 'HVM_boot_params': dict,
'platform_std_vga': bool0,
'platform_serial': str,
'platform_localtime': bool0,
'PV_ramdisk': '',
'PV_args': '',
'PV_bootloader_args': '',
- 'HVM_boot': '',
+ 'HVM_boot_policy': '',
+ 'HVM_boot_params': {},
'memory_static_min': 0,
'memory_dynamic_min': 0,
'shadow_memory': 0,
log.warn("Unable to parse key %s: %s: %s" %
(key, str(val), e))
+ # Compatibility hack -- can go soon.
+ boot_order = sxp.child_value(sxp_cfg, 'HVM_boot')
+ if boot_order:
+ cfg['HVM_boot_policy'] = 'BIOS order'
+ cfg['HVM_boot_params'] = { 'order' : boot_order }
+
# Parsing the device SXP's. In most cases, the SXP looks
# like this:
#
if 'image' in xapi_dict:
self['image'].update(xapi_dict['image'])
else:
- hvm = self['HVM_boot'] != ''
+ hvm = self['HVM_boot_policy'] != ''
self['image']['type'] = hvm and 'hvm' or 'linux'
if hvm:
self['image']['hvm'] = {'devices': {}}
kernel = self.info['PV_kernel']
ramdisk = self.info['PV_ramdisk']
args = self.info['PV_args']
- boot = self.info['HVM_boot']
+ boot = self.info['HVM_boot_policy']
if boot:
# HVM booting.
self.info['image']['type'] = 'hvm'
if not 'devices' in self.info['image']:
self.info['image']['devices'] = {}
- self.info['image']['devices']['boot'] = boot
+ self.info['image']['devices']['boot'] = \
+ self.info['HVM_boot_params'].get('order', 'dc')
elif not blexec and kernel:
# Boot from dom0. Nothing left to do -- the kernel and ramdisk
# will be picked up by image.py.
msgid ""
msgstr ""
"Project-Id-Version: Xen-xm 3.0\n"
-"PO-Revision-Date: 2007-01-30 17:15+0000\n"
+"PO-Revision-Date: 2007-01-31 12:34+0000\n"
"Last-Translator: Ewan Mellor <ewan@xensource.com>\n"
"Language-Team: xen-devel <xen-devel@lists.xensource.com>\n"
"MIME-Version: 1.0\n"
msgid "SESSION_AUTHENTICATION_FAILED"
msgstr "Permission denied."
+msgid "VALUE_NOT_SUPPORTED"
+msgstr "Value \"%(2)s\" for %(1)s is not supported by this server. The server said \"%(3)s\"."
+
msgid "HOST_CPU_HANDLE_INVALID"
msgstr "The host_cpu handle %(1)s is invalid."